package simpleGeom;

import java.util.Vector;

public class Vec2DHelper {
public static HasPos2D getClosest(float x,float y,Vector<? extends HasPos2D>nodes){
	HasPos2D closestPos=nodes.firstElement();
	float minD=Vec2D.distSqr(closestPos, x,y);
	for (int i=0;i<nodes.size();i++){
		HasPos2D cP=nodes.get(i);
		float cD=Vec2D.distSqr(cP, x, y);
		if (cD<minD){
			minD=cD;
			closestPos=cP;
		}
		
	}
	return closestPos;
}


}
